<!DOCTYPE html>
<html>
<body>
<ul role="tree">
  <li role="treeitem" aria-expanded="false">
    Major
  </li>
  <li id="node" role="treeitem" aria-expanded="true">
    Minor
  </li>
  <ul id="subtree" role="group">
    <li role="treeitem">
      Minor Seventh
    </li>
    <li role="treeitem">
      Minor Ninth
    </li>
  </ul>
</ul>
<script>
  function go() {
    var node = document.getElementById('node');
    var subtree = document.getElementById('subtree');
    node.setAttribute('aria-expanded', 'false');
    subtree.hidden = true;
  }
</script>
</body>
</html>
